import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
	state: {
		userInfo: null
	},
	mutations: {
		SET_USER_INFO(state, userinfo) {
			state.userInfo = userinfo
		}
	},
	actions: {
		setUserinfo({
			commit
		}, userinfo) {
			commit('SET_USER_INFO', userinfo)
		}
	},
	getters: {
		openid: state => state.userInfo ? state.userInfo.openid : null,
		userinfo: state => state.userInfo
	}
})

export default store
